﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html class="loginHtml">
<head>
    <meta charset="utf-8">
    <title>登录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="~/Content/layuicms2.0-master/favicon.ico" />
    <link rel="stylesheet" href="~/Content/layuicms2.0-master/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="~/Content/layuicms2.0-master/css/public.css" media="all" />
</head>
<body class="loginBody">
    <form class="layui-form">
        <div class="login_face"><img src="~/Areas/SysAdmin/Image/logo.png" class="userAvatar"></div>
        <div class="layui-form-item input-item">
            <label for="username">用户名</label>
            <input type="text" placeholder="请输入用户名" id="username" class="layui-input" lay-verify="required">
        </div>
        <div class="layui-form-item input-item">
            <label for="password">密码</label>
            <input type="password" placeholder="请输入密码" autocomplete="off" id="password" class="layui-input" lay-verify="required">
        </div>
        @*<div class="layui-form-item input-item" id="imgCode">
            <label for="code">验证码</label>
            <input type="text" placeholder="请输入验证码" autocomplete="off" id="verifyCode" class="layui-input" lay-verify="required">
            <img src="@Url.Action("CreateVerifyCode","Login")" width="116" height="36" id="imgVerifyCode" onclick="javascript:this.src = '@Url.Action("CreateVerifyCode", "Login")'+ '?' + new Date().getTime()">
        </div>*@
        <div class="layui-form-item">
            <button type="button" class="layui-btn layui-block" lay-filter="login" lay-submit="" id="DL">登录</button>
        </div>
        <b id="boldError" style="color: red"></b>
    </form>
    <script src="~/Content/jquery/jquery-2.2.3.min.js"></script>
    <script type="text/javascript" src="~/Content/layuicms2.0-master/layui/layui.js"></script>
    <script type="text/javascript">
        layui.use(['form', 'layer'], function () {
            var form = layui.form
              , layer = layui.layer
              , $ = layui.jquery;

            form.on('submit(login)', function (data) {
                var loading = layer.load();
                $.post('@Url.Action("Login", "Login")'
                    , {
                        username: $('#username').val(),
                        password: $('#password').val(),
                        verifyCode: $('#verifyCode').val()
                    }
                    , function (result) {
                        if (result.Success) {
                            window.location.href = result.Data;
                        } else {
                            $('#boldError').text(result.Message);
                            $('#imgVerifyCode').click();
                            layer.close(loading);
                        }
                    });
                return false;
            });

            //表单输入效果
            $(".loginBody .input-item").click(function (e) {
                e.stopPropagation();
                $(this).addClass("layui-input-focus").find(".layui-input").focus();
            })
            $(".loginBody .layui-form-item .layui-input").focus(function () {
                $(this).parent().addClass("layui-input-focus");
            })
            $(".loginBody .layui-form-item .layui-input").blur(function () {
                $(this).parent().removeClass("layui-input-focus");
                if ($(this).val() != '') {
                    $(this).parent().addClass("layui-input-active");
                } else {
                    $(this).parent().removeClass("layui-input-active");
                }
            })
        });


        document.onkeydown = function () {

            if (event.keyCode == 13) {

                event.returnValue = false;

                event.cancel = true;

                $("#DL").click();

            }

        }


    </script>
</body>
</html>